<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import customerContract from '@/api/customers/customerContract'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()




const options = reactive({
  id: 'customer_contract',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationColumnWidth: 160,
  formOption: {
    viewType: 'drawer',
    width: 800
  },
  api: customerContract.getList,
  add: {
    show: true,
    api: customerContract.save,
    auth: ['customers:customerContract:save']
  },
  edit: {
    show: true,
    api: customerContract.update,
    auth: ['customers:customerContract:update']
  },
  delete: {
    show: true,
    api: customerContract.deletes,
    auth: ['customers:customerContract:delete']
  }
})

const columns = reactive([
  {
    title: "主键",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入主键"
    }
  },
  {
    title: "客户",
    dataIndex: "customer_id",
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入客户"
    }
  },
  {
    title: "生效时间",
    dataIndex: "assert_time",
    formType: "date",
    search: true,
    commonRules: {
      required: true,
      message: "请输入生效时间"
    },
    showTime: true
  },
  {
    title: "截止时间",
    dataIndex: "end_time",
    formType: "date",
    search: true,
    commonRules: {
      required: true,
      message: "请输入截止时间"
    },
    showTime: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "删除时间",
    dataIndex: "deleted_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "备注",
    dataIndex: "remark",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'customers:customerContract' } </script>